/* 
 * File:   DataSet.h
 * Author: André
 *
 * Created on December 4, 2012, 3:19 PM
 */

#ifndef DATASET_H
#define	DATASET_H

#include <iostream>
#include <string>
#include <vector>

using namespace std;

class DataSet {
    
public:
    DataSet(string fname, int k);                                               // if k = 1, normal constructor, else k-fold validation takes place
    virtual ~DataSet();                                                         // destructor to be implemented
    
    int getNumInputs();                                                         // returns number of data inputs
    int getNumOutputs();                                                        // returns number of data outputs
    int getNumHiddenLayers();                                                   // returns number of hidden layers
    int getNumEntries();                                                        // returns total number of entries/records
    int getNumBins();                                                           // returns number of bins/buckets ( > 1 for k-fold cross validation)
    int getNumItemsPerBin();                                                    // returns numEntries/numBins
    
    double getLearningRate();                                                   // returns learning rate
    double getErrorTolerance();                                                 // returns error tolerance
    double getScalingFactor();                                                  // returns scaling factor
    
    int* getNumOfNeuronsPerHiddenLayer();                                       // returns array containing number of neurons per hidden layer
    
    double* getInputEntryFromBin(int bin, int entry);                           // get array of input values from bin
    double* getOutputEntryFromBin(int bin, int entry);                          // get array of output values from bin
    
    void discretizeAttribute(int index);
    void averageAttribute(int index);
    void printWekaFormat();
      
private:
    
    int numInputs;                                                              // number of inputs for the problem
    int numOutputs;                                                             // number of outputs for the problem
    int numBins;                                                                // number of bins the data set shall be separated into
    
    int numHiddenLayers;                                                        // number of hidden layers the network has
    int* numHiddenNeuronsPerLayer;                                              // number of neurons per each hidden layer
    
    int numEntries;                                                             // number of examples in file
    
    double scalingFactor;                                                       // scaling factor value
    double learningRate;                                                        // learning rate value
    double errorTol;                                                            // error tolerance value
    
    void numberOfHiddenNeuronsPerLayer(string numNeuronsPerLayer);              // processes line containing the number of hidden neurons per layer
    void buildDataSet(string filename);                                         // opens file containing data and parses it
    void buildDataSetArrays();                                                  // initializes dataset arrays
    
    double*** inputBinsAndEntries;                                              // [i][j][k] i = number of bin, j = number of entry on bin, k = input array
    double*** outputBinsAndEntries;                                             // [i][j][k] i = number of bin, j = number of entry on bin, k = output array
    
};

#endif	/* DATASET_H */

